/*
 * Copyright (c) 2009 Nokia Corporation.
 */

(function() {
  try {
    console.debug("First init started.");
    var url = window.location.toString();
    console.log(url);
    if (url.indexOf("init=true") != -1) {
      setTimeout(function() { document.getElementById('splashContent').style.display = "none"; },
                     5000);
    }
    else {
      document.getElementById('splashContent').style.display = "none";
    }
    
    setTimeout(function() {
      var scriptFiles = [
      "../js/jquery-1.4.min.js",
      "../js/jquery-ui-1.7.2.custom.min.js",
      "../js/jquery.ba-bbq.min.js",
      "../js/FeedUpdateBroker.js",
      "../js/cartoonreader-libs.js",
      "../js/single-cartoon-view.js"
      ];
      for (i in scriptFiles) {
        var script = document.createElement("script")
        script.type = "text/javascript";
        script.src = scriptFiles[i];
        document.getElementsByTagName("head")[0].appendChild(script);
        console.debug("Adding scriptFile "+scriptFiles[i]);
      }
    }, 0);
    var platform = "";
    if(window.platformResolver) {
      platform = window.platformResolver.platform();
    }
    if ('MAEMO' == platform) {
      document.getElementsByTagName('body')[0].style["font-size"] = "1.25em";
    }

    console.debug("First init ended.");
  }
  catch(e) {
    console.error(e);
    alert(e);
  }
})();
